home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 6 / Amoszine 6 (Disk 2 of 2).adf / paul_nordovics.lha / P_Nordovics / analyzer.Bak / analyzer.amosSourceCode next >
Encoding:
AMOS Source Code  |  1992-02-26  |  2.5 KB  |  120 lines

  1. ' *************************************************************
  2. '
  3. '                      RANDOM NUMBER ANALYZER  
  4. '                      ======================
  5. '
  6. '                              or  
  7. '
  8. '                a sad example of what people with   
  9. '             too much time on their hands get up to!    
  10. '
  11. '                       /\/\/\/\/\/\/\/\/\ 
  12. '                       By: Paul Nordovics   
  13. '                       \/\/\/\/\/\/\/\/\/ 
  14. '
  15. '                 shows the occurence of numbers   
  16. '               1-49 which are generated at random   
  17. '
  18. '              total occurences of a given number =  
  19. '            (bottom graph value*50)+top graph value   
  20. '            as if anybody's gonner bother anyway!!!   
  21. '
  22. ' *************************************************************
  23. '
  24. Hide 
  25. '
  26. ' *************
  27. ' set up screen
  28. ' *************
  29. Unpack 1 To 0
  30. Curs Off : Flash Off 
  31. Screen Display 0,128,45,,
  32. '
  33. Dim NUMBER(49)
  34. '
  35. Randomize Timer
  36. '  
  37. ' *************************************************************
  38. '                                MAIN  
  39. ' *************************************************************
  40. '
  41. Do 
  42.    ' ************** 
  43.    ' get RND number 
  44.    ' ************** 
  45.    Repeat 
  46.       K=Rnd(49)
  47.    Until K>0
  48.    '
  49.    ' ***********************
  50.    ' increase number counter
  51.    ' ***********************
  52.    Add NUMBER(K),1
  53.    '
  54.    ' *******************************
  55.    ' work out y values for each graf
  56.    ' *******************************
  57.    GY2=NUMBER(K)/50
  58.    GY1=NUMBER(K)-(GY2*50)
  59.    '
  60.    ' *************
  61.    ' update graphs
  62.    ' *************
  63.    Gosub BLANK_TOP_GRAPH
  64.    Gosub _DRAW_TOP_GRAPH
  65.    Gosub BLANK_BOTTOM_GRAPH
  66.    Gosub _DRAW_BOTTOM_GRAPH
  67. Loop 
  68. '
  69. ' -------------------------------------------------------------
  70. '
  71. BLANK_TOP_GRAPH:
  72. ' *****
  73. ' blank  
  74. ' *****
  75. X=(K*6)+6 : Y=110
  76. Ink 3
  77. For L=1 To 50
  78.    Draw X,Y To X+4,Y
  79.    Add Y,-2
  80. Next L
  81. Return 
  82. '
  83. ' -------------------------------------------------------------
  84. '
  85. _DRAW_TOP_GRAPH:
  86. If GY1>0
  87.    X=(K*6)+6 : Y=110
  88.    Ink 2
  89.    For L=1 To GY1
  90.       Draw X,Y To X+4,Y
  91.       Add Y,-2
  92.    Next L
  93. End If 
  94. Return 
  95. '
  96. ' -------------------------------------------------------------
  97. '
  98. BLANK_BOTTOM_GRAPH:
  99. X=(K*6)+6 : Y=232
  100. Ink 3
  101. For L=1 To 50
  102.    Draw X,Y To X+4,Y
  103.    Add Y,-2
  104. Next L
  105. Return 
  106. '
  107. ' -------------------------------------------------------------
  108. '
  109. _DRAW_BOTTOM_GRAPH:
  110. If GY2>0
  111.    Ink 2
  112.    X=(K*6)+6 : Y=232
  113.    For L=1 To GY2
  114.       Draw X,Y To X+4,Y
  115.       Add Y,-2
  116.    Next L
  117. End If 
  118. Return 
  119. '
  120. ' -------------------------------------------------------------